-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RichText: fix tree output after applying format #14555
Conversation
a55ce96
to
936cfcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally and it solves the problem as described. Reading the code I don't spot any problem.
Minor thing @ellatrix while the solution here solves the problem there is another inconsistent behavior:
- in a selection containing
test text <b>bold item</b><em>italic!</em>
applying a link results in<a href='#'>test text <b>bold item</b><em>italic!</em></a>
- YET in a selection containing only
<b>bold item</b>
applying a link results in<b><a href='#'>bold item</a></b>
However I am unsure if this is in the scope of this fix, so I say we merge this as it is.
@draganescu Thanks for reviewing! I don't see a problem there, what's wrong with the second case? |
@ellatrix it might not be a problem, the difference is that in the first case the link tags wrap the content and any tags, and in the second case the link tag is placed inside the outer tag. It just doesn't work the same, maybe it doesn't have to, I just noticed :) otherwise no issue. |
Thanks @draganescu. I didn't really think much of it, but you have a point. Maybe the rule for applying tags should be: wrap as much content as possible. Currently it seems to be: wrap as little content as possible. |
Description
Fixes #12314. Still needs some additional tests.
Problem: Applying a format around an existing format (greater selection), will chop the applied format into 2-3 pieces. Why? Because the format is just added at the end of each format array at every index:
Instead, this should be:
Solution: check the position at which to insert first. This should be the lowest value between the start and end indices.
How has this been tested?
Make something bold. Select the bolded text, including something more. Now link it. The link should not be split into two elements.
Screenshots
Types of changes
Checklist: